//下一步
function nextStep() {

	if($("input[name='mnOrg']:checked").length < 1) {
		$("#mn-step01-remind").removeClass("hideDiv");
		return false;
	}

	if($("#m-new-handUp_step02").html() !== "") {
		Modal.hide("#m-new-handUp_step01", function() {
			Modal.show("#m-new-handUp_step02");
		});
		return;
	}

	Modal.hide("#m-new-handUp_step01", function() {
		$("#m-new-handUp_step02").load("../newhandUp_step02.html", function() {
			//获取指挥端所有的完成的预案
			$.ajax({
				url: "http://127.0.0.1:6011/elcs/api/v1/org/ext/getAllPlansByOrgID/" + $("input[name='mnOrg']:checked").eq(0).val(),
				type: "get",
				contentType: "application/json; charset=utf-8",
				success: function(result) {
					var mnPlansUl = $("#mn-plan-ul");
					var OLi = "";
					$.each(result.data, function(i, obj) {
						OLi += `<li>
								<div class='plan-radio'>
									<input type='radio' name='mnPlan' value='` + obj.id + `' id='mnPlan` + obj.id + `' />
									<label class='plan-label' for='mnPlan` + obj.id + `'>&nbsp;</label>
								</div>
								<div class='plan-span'>
									<span>` + obj.plan_title + `</span>
								</div>
							</li>`;
					});
					mnPlansUl.html(OLi);
				},
				error: function() {
					alert("请求出错");
				}
			});
			Modal.show("#m-new-handUp_step02");
		});
	});
}

//点击新建上报按钮
function newHandUp() {
	$("#m-new-handUp_step01").load("../newhandUp_step01.html", function() {
		//获得所有含有预案的指挥端
		$.ajax({
			url: "http://127.0.0.1:6011/elcs/api/v1/org/ext/getAllClientHasPlan",
			type: "get",
			contentType: "application/json; charset=utf-8",
			success: function(result) {
				var mnOrgsUl = $("#mn-orgs-ul");
				var OLi = "";
				$.each(result.data, function(i, obj) {
					OLi += `<li>
						<div class='orgs-radio'>
							<input type='radio' name='mnOrg' value='` + obj.id + `' id='mnOrg` + obj.id + `' />
							<label class='orgs-label' for='mnOrg` + obj.id + `'>&nbsp;</label>
						</div>
						<div class='orgs-span'>
							<span>` + obj.full_name + `</span>
						</div>
					</li>`;
				});
				mnOrgsUl.html(OLi);
			},
			error: function() {
				alert("请求出错");
			}
		});
		Modal.show("#m-new-handUp_step01");
	});
}

//上一步
function lastStep() {
	Modal.hide("#m-new-handUp_step01", function() {
		Modal.show("#m-new-handUp_step01");
	});
}

//点击确认按钮,新建上报
function newHandUpSure() {
	if($("input[name='mnPlan']:checked").length < 1) {
		$("#mn-step02-remind").removeClass("hideDiv");
		return false;
	}
}